All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.actions.MatrixAction

java.lang.Object
   |
   +----quicktime.app.actions.PeriodicAction
           |
           +----quicktime.app.actions.MatrixAction

public abstract class MatrixAction
extends PeriodicAction
implements Targetable
This class provides the means for a basic Matrix actions. Each time the tickle method is called, it will retrieve the matrix from the target and invoke the transformMatrix method, which the subclass must implement. The subclass defines the transformMatrix method to apply a transformation to the matrix of the target of the action.

The MatrixAction will also notify the subclass of any changes of rate direction and if the subclass is interested in constraint testing will notify the subclass which side(s) a targets matrix has collided with after the transformation has been applied. These two states are notified with the rateDirectionChanged and boundsReached methods respectively.

Though the Space is generally specified it is only used in the bounds testing.


Variable Index

 o doConstraintBoundsTesting
Set this boolean to true or false to perform bounds testing of the target within the bounds of its enclosing Space.
 o kBottomSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
 o kLeftSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
 o kRightSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
 o kTopSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with.
 o target
The target of the matrix transformations

Constructor Index

 o MatrixAction(int, int, QTDrawable, Transformable)
Create a PeriodicAction that will act upon a Matrix.

Method Index

 o boundsReached(int)
If the Matrix action is doing constraint bounds testing and a bounding condition is reached the Matrix action calls this method with one of four flags to indicate which side of the enclosing space the target collided with.
 o constraintReached()
Subclasses should return true if after an action is triggered (the doAction method is called) the action has reached one of its specified constraint conditions and the actionable object should be triggered.
 o doAction(float, int)
When called it performs three primary tasks:

Variables

 o kLeftSide
 protected static final int kLeftSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with. Horizontal and Vertical sides are provided as a means for testing for both left and right, up and down respectively.

 o kRightSide
 protected static final int kRightSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with. Horizontal and Vertical sides are provided as a means for testing for both left and right, up and down respectively.

 o kTopSide
 protected static final int kTopSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with. Horizontal and Vertical sides are provided as a means for testing for both left and right, up and down respectively.

 o kBottomSide
 protected static final int kBottomSide
These constants are used in the boundsReached call to indicate to the subclass which edge the target has collided with. Horizontal and Vertical sides are provided as a means for testing for both left and right, up and down respectively.

 o target
 protected Transformable target
The target of the matrix transformations

 o doConstraintBoundsTesting
 protected boolean doConstraintBoundsTesting
Set this boolean to true or false to perform bounds testing of the target within the bounds of its enclosing Space. Default is false. If true the enclosing Space must be specified.

Constructors

 o MatrixAction
 protected MatrixAction(int scale,
                        int period,
                        QTDrawable space,
                        Transformable t) throws QTException
Create a PeriodicAction that will act upon a Matrix.

Parameters:
scale - the amount with which a second is divided into at a rate of one
period - the number of scale ticks that elapse between invocations of the action.
space - the QTDrawable object that is the enclosing space of the Transformable target.
t - a transformable object that will have its display matrix altered by the deltaMatrix

Methods

 o setTarget
 public void setTarget(Object target)
Sets the target of the action. The target must be some kind of Transformable object.

Parameters:
target - a Transformable object
 o getTarget
 public Object getTarget()
Returns the current target of the action.

Returns:
the current target
 o getSpace
 public QTDrawable getSpace()
The space which is the space that the transformable object is a member of.

Returns:
the enclosing space.
 o setSpace
 public void setSpace(QTDrawable space)
Set the space which is the space that the transformable target is a member of.

Parameters:
space - the enclosing space.
 o doAction
 protected void doAction(float er,
                         int t) throws QTException
When called it performs three primary tasks: Once these tasks are performed the target's matrix is set to the transformed matrix through calling the setTargetMatrix with the transformed matrix.

Parameters:
er - the rate at which the action was invoked.
t - the time at which the action was invoked.
Overrides:
doAction in class PeriodicAction
 o rateDirectionChanged
 protected void rateDirectionChanged(boolean forwards) throws QTException
The Matrix action notifies subclasses when the rate at which an action is tickled changes from positive to negative or vice versa.

 o transformMatrix
 protected abstract void transformMatrix(Matrix theMatrix) throws QTException
The Matrix action calls the transformMatrix method with a Matrix that the subclass should transform according to the particular transformation of the subclass.

Parameters:
theMatrix - the matrix to transform.
 o boundsReached
 protected void boundsReached(int whichSide)
If the Matrix action is doing constraint bounds testing and a bounding condition is reached the Matrix action calls this method with one of four flags to indicate which side of the enclosing space the target collided with.

Parameters:
whichSide - a flag that indicates which side
 o setTargetMatrix
 protected void setTargetMatrix(Matrix transformedMatrix) throws QTException
This method is invoked by the doAction method once the matrix has been transformed. The default behaviour of this method is to just call the target's setMatrix method with the transformed matrix.

Parameters:
transformedMatrix - the new matrix for the target
 o constraintReached
 protected boolean constraintReached()
Subclasses should return true if after an action is triggered (the doAction method is called) the action has reached one of its specified constraint conditions and the actionable object should be triggered. How this is defined is determined totally by the subclass. This method will only be called by the tickle method if the Action has an Actionable actor.

Returns:
true if the actionable object (if set) should be triggered
Overrides:
constraintReached in class PeriodicAction
 o toString
 public String toString()
Return a string representation of this class.

Overrides:
toString in class PeriodicAction
 o equals
 public boolean equals(Object obj)
Returns true if the incoming object is a Matrix action with the same target.

Parameters:
obj - the object to test
Returns:
true if equal, false if not
Overrides:
equals in class PeriodicAction

All Packages  Class Hierarchy  This Package  Previous  Next  Index